import store from "../index";

import {
  VuexModule,
  Module,
  Mutation,
  getModule,
  Action,
} from "vuex-module-decorators";
import type { UserInfoType } from "@/types/userInfo";

@Module({ dynamic: true, store, name: "userInfo" })
class UserInfo extends VuexModule {
  public userInfo!: UserInfoType;

  @Mutation
  private SET_USER_INFO(val: any) {
    this.userInfo = val;
  }

  @Action
  public setUserInfo(val: any) {
    this.SET_USER_INFO(val);
  }
}
//使用 getModule 访问器使用更多类型安全机制
export const UserInfoModule = getModule(UserInfo);
